package com.csx;

import ch.qos.logback.classic.LoggerContext;
import com.csx.base.CommonUtils;
import com.csx.base.Config;
import com.csx.base.LogFilter;
import com.yh.csx.bsf.bigdata.BigDataSource;
import com.yh.csx.bsf.core.thread.ThreadPool;
import com.yh.csx.bsf.core.util.LogUtils;
import com.yh.csx.bsf.core.util.ReflectionUtils;
import com.yh.csx.bsf.core.util.WarnUtils;
import lombok.var;
import org.slf4j.ILoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Application {
    @Bean
    LogFilter getLogFilter() {
        var filter = new LogFilter();
        ILoggerFactory factory = LoggerFactory.getILoggerFactory();
        LoggerContext context = ((LoggerContext) factory);
        context.getLogger("ROOT").getAppender("CONSOLE").addFilter(filter);
        return new LogFilter();
    }
    public static void main(String[] args) {
        try {

            SpringApplication.run(Application.class, args);
            Context.CheckDbDataTask.run();
            LogUtils.info(Application.class, Config.ProjectName, "canal 增量消费者已启动!");
        } catch (Exception e) {
            LogUtils.error(Application.class, Config.ProjectName, "严重错误", e);
        }
    }
}
